using UnityEngine;
using System.Collections;

public class guifollow : MonoBehaviour {

public int healthBarWidth;

public int healthBarHeight;

public Texture2D healthBarTexture;

Vector3 screenPosition ;

 
	Transform target; // drag here the object to follow

void Update (){

    screenPosition = Camera.main.WorldToScreenPoint(transform.position);

    screenPosition.y = Screen.height - screenPosition.y;
		
//		transform.position = Camera.main.WorldToViewportPoint(target.position);

}

 

void OnGUI (){  
//		Debug.Log("guiText");
		//rect = new Rect(desiredPos.x, Screen.height - desiredPos.y, size.x, size.y);


  //  GUI.Button(new Rect(screenPosition.x - healthBarWidth/2, screenPosition.y - healthBarHeight/2, healthBarWidth, healthBarHeight),"femur");   
		   GUI.Label(new Rect(screenPosition.x, screenPosition.y, 50, 20),"femur");    

 
 

}
}
